package ResourcePackage
{
	import flash.utils.ByteArray;

	public class ExternalResource
	{
		public static var TYPE_FromURL:int = 0;
		public static var TYPE_FromByteArray:int = 1;
		public static var TYPE_FromResource:int = 2;
		public var resourceDes:Resource;
		protected var loadType:uint;
		protected var url:String;
		protected var byteArray:ByteArray;
		protected var resourceSource:Resource;
		public var loadCompleteCallback:Function;
		public function ExternalResource(des:Resource,loadType:uint,source:Object, callback:Function = null)
		{
			this.resourceDes = des;
			this.loadType = loadType;
			this.loadCompleteCallback = callback;
			switch(this.loadType)
			{
				case ExternalResource.TYPE_FromURL:
					this.url = source as String;
					break;
				case ExternalResource.TYPE_FromByteArray:
					this.byteArray = source as ByteArray;
					break;
				case ExternalResource.TYPE_FromResource:
					this.resourceSource = source as Resource;
					break;
			}
		}
		public function GetLoadType():uint
		{
			return loadType;
		}
		public function GetURL():String
		{
			return url;
		}
		public function GetByteArray():ByteArray
		{
			return byteArray;
		}
		public function GetResourceSource():Resource
		{
			return resourceSource;
		}
	}
}